<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/style/basic_layout.css" rel="stylesheet" type="text/css">
    <link href="/style/common_style.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/jquery/jquery.js"></script>
    <script type="text/javascript" src="/artDialog/jquery.artDialog.js?skin=blue"></script>
    <script type="text/javascript" src="/js/jquery/plugins/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="/js/commonAll.js"></script>
    <title>叩丁狼教育PSS（演示版）-品牌管理</title>
    <style>
        .alt td{ background:black !important;}
    </style>
    <script type="text/javascript">
    		//审核操作
    		$(function(){
    			//绑定点击事件
    			$(".btn_audit").click(function(){
    				var url = $(this).data('audit');
    				//提示框
    				$.dialog({
    					title:'温馨提示',
    					content:'亲,您确认审核吗?',
    					lock:true,
    					icon:'warning',
    		        	//确认执行函数
    					ok:function(){
    						$.get(url,function(data){
    		              		if(data.flag){
    		              			myconfirm('审核成功','succeed',function(){
    		              				window.location.reload();
    		              			},true)
    		              		}else{
    		              			myconfirm(data.errorMsg,'error',true,true)
    		              		}
    						})
    					},
    		        	//否不做任何操作
    					cancel:true
    				});
    			});
    	});
    </script>
</head>
<body>
<form id="searchForm" action="/stockBill/list" method="post">
    <div id="container">
        <div class="ui_content">
            <div class="ui_text_indent">
               <div id="box_border">
                    <div id="box_top">搜索</div>
                    <div id="box_center">
                        
                   <fmt:formatDate  value="${qo.beginDate}" pattern="yyyy-MM-dd" var="beginDate"/>
                   <fmt:formatDate  value="${qo.endDate}" pattern="yyyy-MM-dd" var="endDate"/>
                        开始时间<input name="beginDate" onclick="WdatePicker({maxDate:new Date()});" value="${beginDate}" class="ui_input_txt02 Wdate beginDate"/>~
                        结束时间<input name="endDate" onclick="WdatePicker({maxDate:new Date()});" value="${endDate}" class="ui_input_txt02 Wdate endDate"/>
                        供应商
                        <select name="depotId" class="ui_select01">
                        	<option value="-1" >所有供应商</option>
							<c:forEach items="${depots}" var="depot">
								<option ${depot.id==qo.depotId?'selected':''} value="${depot.id}">${depot.name}</option>
							</c:forEach>
						</select>
                        状态
                        <select id="status" name="status" class="ui_select01">
                            <option value="-1" >所有状态</option>
                            <option value="0" ${qo.status==0?'selected':''}>待审核</option>
                            <option value="1" ${qo.status==1?'selected':''} >已审核</option>
                        </select>
                        <input type="button" value="查询" class="ui_input_btn01 btn_page" data-page="1"/>
                    </div>

                    <div id="box_bottom">
                        <input type="button" value="新增" data-input="/stockBill/input" class="ui_input_btn01 btn_input"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="ui_content">
            <div class="ui_tb">
                <table class="table" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
                    <tr>
                        <th width="30"><input type="checkbox" id="all" /></th>
                        <th>订单编码</th>
                        <th>业务时间</th>
                        <th>仓库</th>
                        <th>总金额</th>
                        <th>总数量</th>
                        <th>录入人</th>
                        <th>审核人</th>
                        <th>状态</th>
                        <th></th>
                    </tr>
                    <tbody>
					<c:forEach items="${result.listData}" var="stockBill">
                    <tr>
                        <td><input type="checkbox" name="IDCheck" class="acb" /></td>
                        <td>${stockBill.sn}</td>
                        <fmt:formatDate  value="${stockBill.vdate}" pattern="yyyy-MM-dd" var="vdate"/>
                        <td>${vdate}</td>
                        <td>${stockBill.depot.name}</td>
                        <td>${stockBill.totalAmount}</td>
                        <td>${stockBill.totalNumber}</td>
                        <td>${stockBill.inputUser.name}</td>
                        <td>${stockBill.auditor.name}</td>
                        <td>
                        	<c:if test="${stockBill.status==1}">
                        		<span style="color: green">已审核</span>
                        	</c:if>
                        	<c:if test="${stockBill.status==0}">
                        		<span style="color: red">待审核</span>
                        	</c:if>
                        </td>
                        <td>
                        	<c:if test="${stockBill.status==0}">
	                            <a href="/stockBill/input?id=${stockBill.id}">编辑</a>
	                            <a href="javascript:;" class="btn_delete" data-deleteid="/stockBill/delete?id=${stockBill.id}">删除</a>
	                            <a href="javascript:;" class="btn_audit" data-audit="/stockBill/audit?id=${stockBill.id}">审核</a>
                        	</c:if>
                        	<c:if test="${stockBill.status==1}">
	                            <a href="/stockBill/show?id=${stockBill.id}">查看</a>
                        	</c:if>
                        </td>
                    </tr>
					</c:forEach>
                    </tbody>
                </table>
            </div>
            <div class="ui_tb_h30">
                <div class="ui_flt" style="height: 30px; line-height: 30px;">
                    共有
                    <span class="ui_txt_bold04">${result.totalCount}</span>
                    条记录，当前第
                    <span class="ui_txt_bold04">${result.currentPage}/${result.totalPage}</span>
                    页
                </div>
                <div class="ui_frt">
                    <input type="button" value="首页" class="ui_input_btn01 btn_page" data-page="1"/>
                    <input type="button" value="上一页" class="ui_input_btn01 btn_page" data-page="${result.prevPage}"/>
                    <input type="button" value="下一页" class="ui_input_btn01 btn_page" data-page="${result.nextPage}"/>
                    <input type="button" value="尾页" class="ui_input_btn01 btn_page" data-page="${result.totalPage}"/>

                    <select name="pageSize" class="ui_select02 change_event">
                        <option>5</option>
                        <option>10</option>
                        <option>15</option>
                    </select>
                    <script type="text/javascript">
	                    	$("[name=pageSize] option").each(function(index,option){
	                			if(option.value=='${result.pageSize}'){
	                				option.selected=true;
	                			}
	                		});
                    </script>
                    转到第<input type="text" name="currentPage" value="${result.currentPage}" class="ui_input_txt01" />页
                    <input type="submit" class="ui_input_btn01" value="跳转"/>
                </div>
            </div>
        </div>
    </div>
</form>
</body>
</html>
